<<usegrids>>
<select name="registertype">
<option value="">Everyone</option>
<option value="1">Export/import users</option>
<option value="5">Foreign Hungarian users</option>
</select>
<button onclick="refresh()">Refresh</button>

<table class="admingrid" id="bulkemails">
</table>
Send "user created" email to <input type="text" name="mailcount" value="50"> users <button onclick="sendUCMail()">Send mail</button>
<script>
grids.bulkemails = {
    url : generateServiceUrl({
        admin : true,
        service : "getbulkusers",
        page : "bulkemails"
    }),
    colNames : [
        "Firstname",
        "Lastname",
        "E-mail address",
        "Companyname"
    ],
    colModel : [
        { name : "firstname",    index : "firstname",   width : 100 },
        { name : "lastname",     index : "lastname",   width : 100 },
        { name : "email",        index : "email",      width : 200 },
        { name : "companyname",  index : "companyname",   width : 350 }
    ],
    caption : "User list"
};

createGrids();

function sendUCMail() {
    var count = jQuery("input[name='mailcount']").val();
    callAdminService( "bulkemails", "senducmail", {
        count : count,
        type : jQuery("select[name='registertype']").val()
    }, {
        success : function() {
            displayMessage("info", "Emails have been sent to users");
            refreshGrid("bulkemails");
        }
    });
}

function refresh() {
    callAdminService("bulkemails", "filter", {
        type : jQuery("select[name='registertype']").val()
    }, {
        success : function(result) {
            setGridData("bulkemails", result.griddata);
        }
    });
}

</script>
